##
# Makefile
#

CC=gcc
CFLAGS=-fno-builtin -nostdinc -Wall
LDFLAGS=-nostdlib -Wl,-N,-Ttext,7C00
OBJCOPY=objcopy

obj-file := myboot.o
bin-file := myboot.bin

all: $(obj-file)
	$(CC) $(LDFLAGS) -o temp.exec $<
	$(OBJCOPY) -O binary temp.exec $(bin-file)
	@rm temp.exec

%.o:%.S
	$(CC) $(CFLAGS) -c $<

test:
	@qemu -fda $(bin-file) -boot a

clean:
	@rm *.o $(bin-file)

